home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2003 December / The Sunday Times - The Month 2003-12.iso / mac / The Month DEC 03 / engine / modules / text_table.swf / scripts / frame_1 / DoAction.as
Text File  |  2003-08-19  |  6KB  |  160 lines

  1. function init()
  2. {
  3.    build();
  4.    _visible = true;
  5.    onComplete();
  6. }
  7. function build()
  8. {
  9.    var strID = Tardis.ActiveSection.id;
  10.    var Colors = Tardis.Colors;
  11.    strSECTION_COLOR = Colors.getString(strID);
  12.    SECTION_COLOR = Colors.getHex(strID);
  13.    SECTION_COLOR50 = Colors.getString(strID + "50");
  14.    DEFAULT_COLOR = Colors.getHex("default");
  15.    DEFAULT_COLOR50 = Colors.getHex("default50");
  16.    strDEFAULT_COLOR50 = Colors.getString("default50");
  17.    modWidth = nodeData.byName("dimensions").attributes.width;
  18.    txtWidth = modWidth - 12;
  19.    modHeight = nodeData.byName("dimensions").attributes.height;
  20.    ndItems = nodeData.byName("items");
  21.    ndDefault = nodeData.byName("default");
  22.    titleFF._width = txtWidth;
  23.    title2FF._width = txtWidth + 15;
  24.    if(nodeData.byName("title").getText() != null || nodeData.byName("title2").getText() != null || nodeData.byName("title3").getText() != null)
  25.    {
  26.       var strTitle = "<FONT COLOR=\"" + strSECTION_COLOR + "\">" + nodeData.byName("title").getText() + " </FONT>";
  27.       strTitle += "<FONT COLOR=\"" + SECTION_COLOR50 + "\"> " + nodeData.byName("title2").getText() + " </FONT>";
  28.       strTitle += "<FONT COLOR=\"" + strDEFAULT_COLOR50 + "\"> " + nodeData.byName("title3").getText() + " </FONT>";
  29.       titleFF.htmlText = strTitle;
  30.       titleFF._y = TEXT_POS;
  31.       titleFF.resize();
  32.       TEXT_POS += Math.ceil(titleFF._height - 3);
  33.    }
  34.    var strByline = nodeData.byName("byline").getText();
  35.    if(strByline != null)
  36.    {
  37.       title2FF.htmlText = strByline;
  38.       title2FF.textColor = DEFAULT_COLOR;
  39.       title2FF.resize();
  40.       title2FF._y = TEXT_POS;
  41.       TEXT_POS += Math.ceil(title2FF._height - 7);
  42.    }
  43.    attachMovie("tableElement568","tableHeadMC",Tardis.depth++);
  44.    tableHeadMC._x = 6;
  45.    var objText = tableHeadMC.textHolderMC;
  46.    objText.col1FF.htmlText = ndDefault.byName("col1").getText();
  47.    objText.col1FF.resize();
  48.    objText.col1FF.textColor = DEFAULT_COLOR;
  49.    objText.col2FF.htmlText = ndDefault.byName("col2").getText();
  50.    objText.col2FF.resize();
  51.    objText.col2FF.textColor = DEFAULT_COLOR;
  52.    objText.col3FF.htmlText = ndDefault.byName("col3").getText();
  53.    objText.col3FF.resize();
  54.    objText.col3FF.textColor = DEFAULT_COLOR;
  55.    objText.col4FF.htmlText = ndDefault.byName("col4").getText();
  56.    objText.col4FF.resize();
  57.    objText.col4FF.textColor = DEFAULT_COLOR;
  58.    objText.col5FF.htmlText = ndDefault.byName("col5").getText();
  59.    objText.col5FF.resize();
  60.    objText.col5FF.textColor = DEFAULT_COLOR;
  61.    objText.bgMC._height = objText.col5FF._height;
  62.    tableHeadMC.bgMC._visible = false;
  63.    tableHeadMC.bgMC._height = 0;
  64.    tableHeadMC._y = TEXT_POS;
  65.    TEXT_POS += tableHeadMC._height;
  66.    this.attachMovie("scrollContentMC","sMC",Tardis.depth++);
  67.    x = 0;
  68.    while(x < ndItems.childNodes.length)
  69.    {
  70.       sMC.attachMovie("tableElement568","mc_t_" + x,Tardis.depth++);
  71.       objClip = eval("sMC.mc_t_" + x);
  72.       objText = eval(objClip + ".textHolderMC");
  73.       objClip._y = CONTENT_POS;
  74.       objText.col1FF.htmlText = ndItems.childNodes[x].byName("col1").getText();
  75.       objText.col1FF.autosize = true;
  76.       var MAX_HEIGHT = objText.col1FF._height;
  77.       objText.col2FF.htmlText = ndItems.childNodes[x].byName("col2").getText();
  78.       objText.col2FF.autosize = true;
  79.       if(objText.col2FF._height > MAX_HEIGHT)
  80.       {
  81.          MAX_HEIGHT = objText.col2FF._height;
  82.       }
  83.       objText.col3FF.htmlText = ndItems.childNodes[x].byName("col3").getText();
  84.       objText.col3FF.autosize = true;
  85.       if(objText.col3FF._height > MAX_HEIGHT)
  86.       {
  87.          MAX_HEIGHT = objText.col3FF._height;
  88.       }
  89.       objText.col4FF.htmlText = ndItems.childNodes[x].byName("col4").getText();
  90.       objText.col4FF.autosize = true;
  91.       if(objText.col4FF._height > MAX_HEIGHT)
  92.       {
  93.          MAX_HEIGHT = objText.col4FF._height;
  94.       }
  95.       objText.col5FF.htmlText = ndItems.childNodes[x].byName("col5").getText();
  96.       objText.col5FF.autosize = true;
  97.       if(objText.col5FF._height > MAX_HEIGHT)
  98.       {
  99.          MAX_HEIGHT = objText.col5FF._height;
  100.       }
  101.       objText.bgMC._height = MAX_HEIGHT + 8;
  102.       objClip.bgMC._height = objText._height + 1;
  103.       objClip.bgMC._width = objText._width - 4;
  104.       objText.col1FF.textColor = objText.col2FF.textColor = objText.col3FF.textColor = objText.col4FF.textColor = objText.col5FF.textColor = DEFAULT_COLOR;
  105.       CONTENT_POS += objClip._height - 1;
  106.       x++;
  107.    }
  108.    var ndBodyLink = nodeData.byName("bodylink");
  109.    if(ndBodyLink.byName("title").getText() != null)
  110.    {
  111.       bodyLinkMC.contentFF.htmlText = ndBodyLink.byName("title").getText();
  112.       bodyLinkMC.contentFF.textColor = SECTION_COLOR;
  113.       bodyLinkMC.contentFF.autoSize = true;
  114.       bodyLinkMC.arrowMC._x = bodyLinkMC.contentFF._width + 5;
  115.       var arwColor = new Color("bodyLinkMC.arrowMC");
  116.       arwColor.setRGB(SECTION_COLOR);
  117.       bodyLinkMC.btn._width = bodyLinkMC.contentFF._width + bodyLinkMC.arrowMC._width;
  118.    }
  119.    else
  120.    {
  121.       bodyLinkMC.arrowMC._visible = false;
  122.       bodyLinkMC.btn._width = sMC.bodyLinkMC.btn._height = 0;
  123.       bodyLinkMC.btn.enabled = false;
  124.       bodyLinkMC.contentFF._height = 0;
  125.    }
  126.    if(sMC._height > modHeight - bodyLinkMC.contentFF._height - TEXT_POS)
  127.    {
  128.       this.attachMovie("FScrollPaneSymbol","contentScroll",Tardis.depth++);
  129.       attachMovie("textBgMC","MaskerMC",Tardis.depth++);
  130.       MaskerMC._height = 1;
  131.       MaskerMC._width = tableHeadMC._width;
  132.       contentScroll._x = 5;
  133.       contentScroll._y = TEXT_POS;
  134.       contentScroll.setSize(modWidth,modHeight - bodyLinkMC.contentFF._height - TEXT_POS);
  135.       contentScroll.setHScroll(false);
  136.       contentScroll.setScrollContent(sMC);
  137.       MaskerMC._x = 10;
  138.       MaskerMC._y = TEXT_POS;
  139.       TEXT_POS += contentScroll._height + 3;
  140.       title2FF._width = txtWidth;
  141.       title2FF.resize();
  142.    }
  143.    else
  144.    {
  145.       sMC.bodyFF._width += 10;
  146.       sMC.bodyFF.autoSize = true;
  147.       sMC._x = 8;
  148.       sMC._y = TEXT_POS;
  149.       TEXT_POS += sMC._height;
  150.    }
  151.    bodyLinkMC._y = TEXT_POS;
  152. }
  153. _visible = false;
  154. stop();
  155. SCROLLBOX_INIT_POS = 58;
  156. TEXT_POS = 6;
  157. CONTENT_POS = 0;
  158. onReady();
  159. v;
  160.